Skip to content

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 25, 2024

A dev build almost certainly means that whoever's built the compiler has the opportunity to rerun it to collect a more complete trace. So we don't need to default to a complete trace; we should hide irrelevant details by default.

A dev build almost certainly means that whoever's built the compiler
has the opportunity to rerun it to collect a more complete trace. So
we don't need to default to a complete trace; we should hide irrelevant
details by default.
@rustbot
Copy link
Collaborator

rustbot commented Dec 25, 2024

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 25, 2024
@jieyouxu
Copy link
Member

r? jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned lcnr Dec 25, 2024
@jyn514
Copy link
Member Author

jyn514 commented Dec 25, 2024

here is an example short backtrace:

stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_hir_typeck::fatally_break_rust
   3: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args::{closure#0}
   4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
   6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args::{closure#0}
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   8: rustc_hir_typeck::check::check_fn
   9: rustc_hir_typeck::typeck
      [... omitted 1 frame ...]
  10: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#4}>::{closure#0}
  11: rustc_hir_analysis::check_crate
  12: rustc_interface::passes::run_required_analyses
  13: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  14: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}

and here are the frames it's omitting:

stack backtrace:
   0:     0x73e0a193da9a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2e65b410ada06bb6
   1:     0x73e0a2013e66 - core::fmt::write::hfced879cb5c426cb
   2:     0x73e0a2fe69d1 - std::io::Write::write_fmt::ha93774a14ff06c22
   3:     0x73e0a193d8f2 - std::sys::backtrace::BacktraceLock::print::h56a27b4c76c5a732
   4:     0x73e0a193fe0a - std::panicking::default_hook::{{closure}}::h60fb7a06be4c8b99
   5:     0x73e0a193fc53 - std::panicking::default_hook::h71be38530d3aeff2
   6:     0x73e0a0aaf968 - std[b9e8b20294053ab]::panicking::update_hook::<alloc[f74aba53db8a2a5b]::boxed::Box<rustc_driver_impl[299662837a2a7e44]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x73e0a1940608 - std::panicking::rust_panic_with_hook::h95ea5298a8d72379
   8:     0x73e0a0ae4e81 - std[b9e8b20294053ab]::panicking::begin_panic::<rustc_errors[bbd362b0755ce9c5]::ExplicitBug>::{closure#0}
   9:     0x73e0a0ada026 - std[b9e8b20294053ab]::sys::backtrace::__rust_end_short_backtrace::<std[b9e8b20294053ab]::panicking::begin_panic<rustc_errors[bbd362b0755ce9c5]::ExplicitBug>::{closure#0}, !>
  10:     0x73e0a0ad9ddf - std[b9e8b20294053ab]::panicking::begin_panic::<rustc_errors[bbd362b0755ce9c5]::ExplicitBug>
  11:     0x73e0a0aeee21 - <rustc_errors[bbd362b0755ce9c5]::diagnostic::BugAbort as rustc_errors[bbd362b0755ce9c5]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x73e0a0e03cb2 - rustc_hir_typeck[ccf1d9e8e073a553]::fatally_break_rust
  13:     0x73e0a30c7dda - <rustc_hir_typeck[ccf1d9e8e073a553]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args::{closure#0}
  14:     0x73e0a216bde6 - <rustc_hir_typeck[ccf1d9e8e073a553]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  15:     0x73e0a21685be - <rustc_hir_typeck[ccf1d9e8e073a553]::fn_ctxt::FnCtxt>::check_expr_block
  16:     0x73e0a30b1dd4 - <rustc_hir_typeck[ccf1d9e8e073a553]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args::{closure#0}
  17:     0x73e0a216bde6 - <rustc_hir_typeck[ccf1d9e8e073a553]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18:     0x73e0a278bbd0 - rustc_hir_typeck[ccf1d9e8e073a553]::check::check_fn
  19:     0x73e0a2793b72 - rustc_hir_typeck[ccf1d9e8e073a553]::typeck
  20:     0x73e0a279275d - rustc_query_impl[6f59bfe60b3ab7e5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f59bfe60b3ab7e5]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c0dadf335512b82]::query::erase::Erased<[u8; 8usize]>>
  21:     0x73e0a22a0891 - rustc_query_system[c24e345390a82e0e]::query::plumbing::try_execute_query::<rustc_query_impl[6f59bfe60b3ab7e5]::DynamicConfig<rustc_data_structures[be572b2bdcd238e6]::vec_cache::VecCache<rustc_span[653dcdcbb5e9e56f]::def_id::LocalDefId, rustc_middle[c0dadf335512b82]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[c24e345390a82e0e]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6f59bfe60b3ab7e5]::plumbing::QueryCtxt, false>
  22:     0x73e0a229fb4d - rustc_query_impl[6f59bfe60b3ab7e5]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  23:     0x73e0a229f7ff - <rustc_middle[c0dadf335512b82]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[e5c0829c58e01b14]::check_crate::{closure#4}>::{closure#0}
  24:     0x73e0a229d812 - rustc_hir_analysis[e5c0829c58e01b14]::check_crate
  25:     0x73e0a2465c3c - rustc_interface[4b35c70d9e3f2ffb]::passes::run_required_analyses
  26:     0x73e0a3005a5e - rustc_interface[4b35c70d9e3f2ffb]::passes::analysis
  27:     0x73e0a3005a2f - rustc_query_impl[6f59bfe60b3ab7e5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6f59bfe60b3ab7e5]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c0dadf335512b82]::query::erase::Erased<[u8; 1usize]>>
  28:     0x73e0a2fd9f3a - rustc_query_system[c24e345390a82e0e]::query::plumbing::try_execute_query::<rustc_query_impl[6f59bfe60b3ab7e5]::DynamicConfig<rustc_query_system[c24e345390a82e0e]::query::caches::SingleCache<rustc_middle[c0dadf335512b82]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6f59bfe60b3ab7e5]::plumbing::QueryCtxt, false>
  29:     0x73e0a2fd9c0e - rustc_query_impl[6f59bfe60b3ab7e5]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  30:     0x73e0a3068b39 - rustc_interface[4b35c70d9e3f2ffb]::interface::run_compiler::<core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>, rustc_driver_impl[299662837a2a7e44]::run_compiler::{closure#0}>::{closure#1}
  31:     0x73e0a2f25a61 - std[b9e8b20294053ab]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4b35c70d9e3f2ffb]::util::run_in_thread_with_globals<rustc_interface[4b35c70d9e3f2ffb]::util::run_in_thread_pool_with_globals<rustc_interface[4b35c70d9e3f2ffb]::interface::run_compiler<core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>, rustc_driver_impl[299662837a2a7e44]::run_compiler::{closure#0}>::{closure#1}, core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>>::{closure#0}, core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>>
  32:     0x73e0a2f25708 - <<std[b9e8b20294053ab]::thread::Builder>::spawn_unchecked_<rustc_interface[4b35c70d9e3f2ffb]::util::run_in_thread_with_globals<rustc_interface[4b35c70d9e3f2ffb]::util::run_in_thread_pool_with_globals<rustc_interface[4b35c70d9e3f2ffb]::interface::run_compiler<core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>, rustc_driver_impl[299662837a2a7e44]::run_compiler::{closure#0}>::{closure#1}, core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>>::{closure#0}, core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[57c74c06c5b92a92]::result::Result<(), rustc_span[653dcdcbb5e9e56f]::ErrorGuaranteed>>::{closure#1} as core[57c74c06c5b92a92]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x73e0a2f24e3b - std::sys::pal::unix::thread::Thread::new::thread_start::h72b7cc34db2bc86e
  34:     0x73e09d094ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  35:     0x73e09d126850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  36:                0x0 - <unknown>

(note that the "X frames omitted" logic is wrong; that's a pre-existing bug that i happened to fix as part of https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Use.20debuginfo.20for.20short.20backtrace.20printing.20compiler-tea.2E.2E.2E)

@jieyouxu
Copy link
Member

jieyouxu commented Dec 25, 2024

Example ICE on native x86_64-pc-windows-msvc after this PR:

`x86_64-pc-windows-msvc` before
PS X:\repos\rust> rustc +stage1 .\foo.rs -Ztreat-err-as-bug=1
error: internal compiler error[E0601]: `main` function not found in crate `foo`
 --> .\foo.rs:1:13
  |
1 | fn meow() {}
  |             ^ consider adding a `main` function to `.\foo.rs`

thread 'rustc' panicked at compiler\rustc_errors\src\lib.rs:1781:17:
aborting due to `-Z treat-err-as-bug=1`
stack backtrace:
   0:     0x7fff55c7186b - std::backtrace_rs::backtrace::dbghelp64::trace
                               at X:\repos\rust\library\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7fff55c7186b - std::backtrace_rs::backtrace::trace_unsynchronized<std::sys::backtrace::_print_fmt::closure_env$1>
                               at X:\repos\rust\library\backtrace\src\backtrace\mod.rs:66
   2:     0x7fff55c557d1 - std::sys::backtrace::_print_fmt
                               at X:\repos\rust\library\std\src\sys\backtrace.rs:66
   3:     0x7fff55c557d1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at X:\repos\rust\library\std\src\sys\backtrace.rs:39
   4:     0x7fff55c9003d - core::fmt::write
                               at X:\repos\rust\library\core\src\fmt\mod.rs:1440
   5:     0x7fff55c62bf1 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at X:\repos\rust\library\std\src\io\mod.rs:1887
   6:     0x7fff55c556b7 - std::sys::backtrace::BacktraceLock::print
                               at X:\repos\rust\library\std\src\sys\backtrace.rs:42
   7:     0x7fff55c2f779 - std::panicking::default_hook::closure$1
                               at X:\repos\rust\library\std\src\panicking.rs:279
   8:     0x7fff55c2f4a2 - std::panicking::default_hook
                               at X:\repos\rust\library\std\src\panicking.rs:306
   9:     0x7fff4fe3b9a6 - rustc_driver_impl::install_ice_hook::closure$0
                               at X:\repos\rust\compiler\rustc_driver_impl\src\lib.rs:1417
  10:     0x7fff4fe3b9a6 - alloc::boxed::impl$30::call<tuple$<ref$<dyn$<core::ops::function::Fn<tuple$<ref$<std::panic::PanicHookInfo> >,assoc$<Output,tuple$<> > >,core::marker::Send,core::marker::Sync> >,ref$<std::panic::PanicHookInfo> >,rustc_driver_impl::install_ice_hook::closure
                               at X:\repos\rust\library\alloc\src\boxed.rs:1984
  11:     0x7fff55c2fe48 - std::panicking::rust_panic_with_hook
                               at X:\repos\rust\library\std\src\panicking.rs:820
  12:     0x7fff55c6313d - std::panicking::begin_panic_handler::closure$0
                               at X:\repos\rust\library\std\src\panicking.rs:678
  13:     0x7fff55c630bf - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at X:\repos\rust\library\std\src\sys\backtrace.rs:168
  14:     0x7fff55c2f855 - std::panicking::begin_panic_handler
                               at X:\repos\rust\library\std\src\panicking.rs:676
  15:     0x7fff56a37f81 - core::panicking::panic_fmt
                               at X:\repos\rust\library\core\src\panicking.rs:75
  16:     0x7fff55772c84 - rustc_errors::DiagCtxtInner::panic_if_treat_err_as_bug
                               at X:\repos\rust\compiler\rustc_errors\src\lib.rs:1781
  17:     0x7fff557720a4 - rustc_errors::impl$10::emit_diagnostic::closure$3
                               at X:\repos\rust\compiler\rustc_errors\src\lib.rs:1622
  18:     0x7fff50094ead - rustc_interface::callbacks::track_diagnostic::closure$0::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\callbacks.rs:50
  19:     0x7fff50094ead - rustc_middle::ty::context::tls::enter_context::closure$0
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:72
  20:     0x7fff50094ead - std::thread::local::LocalKey::try_with
                               at X:\repos\rust\library\std\src\thread\local.rs:308
  21:     0x7fff50094ead - std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_interface::callbacks::track_diagnostic::closure$0::closure_env$0<enum2$<core::option::Option<rustc_span::ErrorGua
                               at X:\repos\rust\library\std\src\thread\local.rs:272
  22:     0x7fff500cff64 - rustc_middle::ty::context::tls::with_context_opt
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:91
  23:     0x7fff500cff64 - rustc_interface::callbacks::track_diagnostic<enum2$<core::option::Option<rustc_span::ErrorGuaranteed> > >
                               at X:\repos\rust\compiler\rustc_interface\src\callbacks.rs:42
  24:     0x7fff55771169 - rustc_errors::DiagCtxtInner::emit_diagnostic
                               at X:\repos\rust\compiler\rustc_errors\src\lib.rs:1551
  25:     0x7fff5576f98e - rustc_errors::DiagCtxtHandle::emit_diagnostic
                               at X:\repos\rust\compiler\rustc_errors\src\lib.rs:1080
  26:     0x7fff557cf1ec - rustc_errors::diagnostic::Diag::emit_producing_error_guaranteed<rustc_span::ErrorGuaranteed>
                               at X:\repos\rust\compiler\rustc_errors\src\diagnostic.rs:1323
  27:     0x7fff53ac1c57 - rustc_errors::DiagCtxtHandle::emit_err<rustc_passes::errors::NoMainErr>
                               at X:\repos\rust\compiler\rustc_errors\src\lib.rs:1285
  28:     0x7fff53a22963 - rustc_passes::entry::no_main_err
                               at X:\repos\rust\compiler\rustc_passes\src\entry.rs:164
  29:     0x7fff53a22963 - rustc_passes::entry::configure_main
                               at X:\repos\rust\compiler\rustc_passes\src\entry.rs:129
  30:     0x7fff53a22963 - rustc_passes::entry::entry_fn
                               at X:\repos\rust\compiler\rustc_passes\src\entry.rs:50
  31:     0x7fff54034dde - rustc_query_impl::plumbing::__rust_begin_short_backtrace<rustc_query_impl::query_impl::entry_fn::dynamic_query::closure$2::closure_env$0,rustc_middle::query::erase::Erased<array$<u8,12> > >
                               at X:\repos\rust\compiler\rustc_query_impl\src\plumbing.rs:548
  32:     0x7fff53e400fb - core::ops::function::FnOnce::call_once<rustc_query_impl::query_impl::entry_fn::dynamic_query::closure_env$2,tuple$<rustc_middle::ty::context::TyCtxt,tuple$<> > >
                               at X:\repos\rust\library\core\src\ops\function.rs:250
  33:     0x7fff541081c2 - rustc_query_impl::impl$2::compute
                               at X:\repos\rust\compiler\rustc_query_impl\src\lib.rs:110
  34:     0x7fff541081c2 - rustc_query_system::query::plumbing::execute_job_non_incr::closure$0
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:473
  35:     0x7fff541081c2 - rustc_middle::ty::context::tls::enter_context::closure$0
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:72
  36:     0x7fff541081c2 - std::thread::local::LocalKey::try_with
                               at X:\repos\rust\library\std\src\thread\local.rs:308
  37:     0x7fff541081c2 - std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_query_system::query::plumbing::execute_job_non_incr::closure_env$0<rustc_query_impl::DynamicConfig<rustc_query_sy
                               at X:\repos\rust\library\std\src\thread\local.rs:272
  38:     0x7fff53d707d7 - rustc_middle::ty::context::tls::with_context_opt
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:91
  39:     0x7fff53d707d7 - rustc_middle::ty::context::tls::with_context
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:102
  40:     0x7fff53d707d7 - rustc_middle::ty::context::tls::with_related_context
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:115
  41:     0x7fff53d707d7 - rustc_query_impl::plumbing::impl$3::start_query
                               at X:\repos\rust\compiler\rustc_query_impl\src\plumbing.rs:136
  42:     0x7fff53d707d7 - rustc_query_system::query::plumbing::execute_job_non_incr
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:473
  43:     0x7fff53d707d7 - rustc_query_system::query::plumbing::execute_job
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:409
  44:     0x7fff53d707d7 - rustc_query_system::query::plumbing::try_execute_query<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<array$<u8,12> > >,false,false,false>,rustc_query_impl::plumbing::QueryCtxt,false>
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:353
  45:     0x7fff53e410e9 - rustc_query_system::query::plumbing::get_query_non_incr::closure$0
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:806
  46:     0x7fff53e410e9 - stacker::maybe_grow
                               at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\stacker-0.1.17\src\lib.rs:55
  47:     0x7fff53e410e9 - rustc_data_structures::stack::ensure_sufficient_stack
                               at X:\repos\rust\compiler\rustc_data_structures\src\stack.rs:21
  48:     0x7fff53e410e9 - rustc_query_system::query::plumbing::get_query_non_incr
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:806
  49:     0x7fff53e410e9 - rustc_query_impl::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
                               at X:\repos\rust\compiler\rustc_query_impl\src\plumbing.rs:598
  50:     0x7fff5008f202 - rustc_middle::query::plumbing::query_ensure
                               at X:\repos\rust\compiler\rustc_middle\src\query\plumbing.rs:159
  51:     0x7fff5008f202 - rustc_middle::query::plumbing::TyCtxtEnsure::entry_fn
                               at X:\repos\rust\compiler\rustc_middle\src\query\plumbing.rs:194
  52:     0x7fff5008f202 - rustc_interface::passes::run_required_analyses::closure$0::closure$1::closure$0::closure$6::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:836
  53:     0x7fff5008f202 - rustc_data_structures::profiling::VerboseTimingGuard::run
                               at X:\repos\rust\compiler\rustc_data_structures\src\profiling.rs:753
  54:     0x7fff5008f202 - rustc_session::session::Session::time<tuple$<>,rustc_interface::passes::run_required_analyses::closure$0::closure$1::closure$0::closure$6::closure_env$0>
                               at X:\repos\rust\compiler\rustc_session\src\utils.rs:16
  55:     0x7fff5010163f - core::panic::unwind_safe::impl$25::call_once
                               at X:\repos\rust\library\core\src\panic\unwind_safe.rs:272
  56:     0x7fff5010163f - std::panicking::try::do_call
                               at X:\repos\rust\library\std\src\panicking.rs:568
  57:     0x7fff5010163f - std::panicking::try
                               at X:\repos\rust\library\std\src\panicking.rs:531
  58:     0x7fff5010163f - std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::run_required_analyses::closure$0::closure$0::closure_env$0>,tuple$<> >
                               at X:\repos\rust\library\std\src\panic.rs:358
  59:     0x7fff500c32d3 - rustc_data_structures::sync::parallel::ParallelGuard::run<tuple$<>,rustc_interface::passes::run_required_analyses::closure$0::closure$0::closure_env$0>
                               at X:\repos\rust\compiler\rustc_data_structures\src\sync\parallel.rs:26
  60:     0x7fff5008f96f - rustc_interface::passes::run_required_analyses::closure$0::closure$0
                               at X:\repos\rust\compiler\rustc_data_structures\src\sync\parallel.rs:90
  61:     0x7fff5008f96f - rustc_data_structures::sync::parallel::parallel_guard
                               at X:\repos\rust\compiler\rustc_data_structures\src\sync\parallel.rs:42
  62:     0x7fff5008f96f - rustc_interface::passes::run_required_analyses::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:834
  63:     0x7fff5008f96f - rustc_data_structures::profiling::VerboseTimingGuard::run
                               at X:\repos\rust\compiler\rustc_data_structures\src\profiling.rs:753
  64:     0x7fff5008f96f - rustc_session::session::Session::time<tuple$<>,rustc_interface::passes::run_required_analyses::closure_env$0>
                               at X:\repos\rust\compiler\rustc_session\src\utils.rs:16
  65:     0x7fff5006035f - rustc_interface::passes::run_required_analyses
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:833
  66:     0x7fff5006035f - rustc_interface::passes::analysis
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:931
  67:     0x7fff540345c2 - rustc_query_impl::plumbing::__rust_begin_short_backtrace<rustc_query_impl::query_impl::analysis::dynamic_query::closure$2::closure_env$0,rustc_middle::query::erase::Erased<array$<u8,0> > >
                               at X:\repos\rust\compiler\rustc_query_impl\src\plumbing.rs:548
  68:     0x7fff53e43dd4 - core::ops::function::FnOnce::call_once<rustc_query_impl::query_impl::analysis::dynamic_query::closure_env$2,tuple$<rustc_middle::ty::context::TyCtxt,tuple$<> > >
                               at X:\repos\rust\library\core\src\ops\function.rs:250
  69:     0x7fff54107e8d - rustc_query_impl::impl$2::compute
                               at X:\repos\rust\compiler\rustc_query_impl\src\lib.rs:110
  70:     0x7fff54107e8d - rustc_query_system::query::plumbing::execute_job_non_incr::closure$0
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:473
  71:     0x7fff54107e8d - rustc_middle::ty::context::tls::enter_context::closure$0
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:72
  72:     0x7fff54107e8d - std::thread::local::LocalKey::try_with
                               at X:\repos\rust\library\std\src\thread\local.rs:308
  73:     0x7fff54107e8d - std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_query_system::query::plumbing::execute_job_non_incr::closure_env$0<rustc_query_impl::DynamicConfig<rustc_query_sy
                               at X:\repos\rust\library\std\src\thread\local.rs:272
  74:     0x7fff53d66c55 - rustc_middle::ty::context::tls::with_context_opt
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:91
  75:     0x7fff53d66c55 - rustc_middle::ty::context::tls::with_context
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:102
  76:     0x7fff53d66c55 - rustc_middle::ty::context::tls::with_related_context
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:115
  77:     0x7fff53d66c55 - rustc_query_impl::plumbing::impl$3::start_query
                               at X:\repos\rust\compiler\rustc_query_impl\src\plumbing.rs:136
  78:     0x7fff53d66c55 - rustc_query_system::query::plumbing::execute_job_non_incr
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:473
  79:     0x7fff53d66c55 - rustc_query_system::query::plumbing::execute_job
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:409
  80:     0x7fff53d66c55 - rustc_query_system::query::plumbing::try_execute_query<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<array$<u8,0> > >,false,false,false>,rustc_query_impl::plumbing::QueryCtxt,false>
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:353
  81:     0x7fff53e44781 - rustc_query_system::query::plumbing::get_query_non_incr::closure$0
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:806
  82:     0x7fff53e44781 - stacker::maybe_grow
                               at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\stacker-0.1.17\src\lib.rs:55
  83:     0x7fff53e44781 - rustc_data_structures::stack::ensure_sufficient_stack
                               at X:\repos\rust\compiler\rustc_data_structures\src\stack.rs:21
  84:     0x7fff53e44781 - rustc_query_system::query::plumbing::get_query_non_incr
                               at X:\repos\rust\compiler\rustc_query_system\src\query\plumbing.rs:806
  85:     0x7fff53e44781 - rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
                               at X:\repos\rust\compiler\rustc_query_impl\src\plumbing.rs:598
  86:     0x7fff4fe504d3 - rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:813
  87:     0x7fff4fe504d3 - rustc_middle::ty::context::impl$23::create_global_ctxt::closure$3
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context.rs:1556
  88:     0x7fff4fe504d3 - rustc_middle::ty::context::tls::enter_context::closure$0
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:72
  89:     0x7fff4fe504d3 - std::thread::local::LocalKey::try_with
                               at X:\repos\rust\library\std\src\thread\local.rs:308
  90:     0x7fff4fe504d3 - std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_middle::ty::context::impl$23::create_global_ctxt::closure_env$3<enum2$<core::option::Option<rustc_interface::quer
                               at X:\repos\rust\library\std\src\thread\local.rs:272
  91:     0x7fff4fe2c348 - rustc_middle::ty::context::tls::enter_context
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context\tls.rs:69
  92:     0x7fff4fe2c348 - rustc_middle::ty::context::TyCtxt::create_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure_env$0<enum2$<core::option::Option<rustc_interface::queries::Link
                               at X:\repos\rust\compiler\rustc_middle\src\ty\context.rs:1556
  93:     0x7fff4fe82ca3 - rustc_interface::passes::create_and_enter_global_ctxt::closure$2
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:781
  94:     0x7fff4fe82ca3 - core::ops::function::FnOnce::call_once<rustc_interface::passes::create_and_enter_global_ctxt::closure_env$2<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>,tuple$<ref$<rustc_session
                               at X:\repos\rust\library\core\src\ops\function.rs:250
  95:     0x7fff4fe3b4cf - alloc::boxed::impl$28::call_once<tuple$<ref$<rustc_session::session::Session>,rustc_middle::ty::context::CurrentGcx,ref$<std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt> >,ref$<rustc_data_structures::sync::worker_local::WorkerLocal<rus
                               at X:\repos\rust\library\alloc\src\boxed.rs:1970
  96:     0x7fff4fe80f09 - rustc_interface::passes::create_and_enter_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>
                               at X:\repos\rust\compiler\rustc_interface\src\passes.rs:821
  97:     0x7fff4fe626b6 - rustc_interface::interface::run_compiler::closure$1::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\interface.rs:499
  98:     0x7fff4fe626b6 - core::panic::unwind_safe::impl$25::call_once
                               at X:\repos\rust\library\core\src\panic\unwind_safe.rs:272
  99:     0x7fff4fe626b6 - std::panicking::try::do_call
                               at X:\repos\rust\library\std\src\panicking.rs:568
 100:     0x7fff4fe626b6 - std::panicking::try
                               at X:\repos\rust\library\std\src\panicking.rs:531
 101:     0x7fff4fe626b6 - std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::closure$1::closure_env$0<tuple$<>,rustc_driver_impl::run_compiler::closure_env$0> >,tuple$<> >
                               at X:\repos\rust\library\std\src\panic.rs:358
 102:     0x7fff4fe6eb2f - rustc_interface::interface::run_compiler::closure$1
                               at X:\repos\rust\compiler\rustc_interface\src\interface.rs:499
 103:     0x7fff4fe6eb2f - rustc_interface::util::run_in_thread_pool_with_globals::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\util.rs:143
 104:     0x7fff4fe6eb2f - rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\util.rs:106
 105:     0x7fff4fe6eb2f - scoped_tls::ScopedKey::set<rustc_span::SessionGlobals,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::clo
                               at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\scoped-tls-1.0.1\src\lib.rs:137
 106:     0x7fff4fe21aba - rustc_span::create_session_globals_then<tuple$<>,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::closure_
                               at X:\repos\rust\compiler\rustc_span\src\lib.rs:138
 107:     0x7fff4fe6815d - rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0
                               at X:\repos\rust\compiler\rustc_interface\src\util.rs:105
 108:     0x7fff4fe6815d - std::sys::backtrace::__rust_begin_short_backtrace<rustc_interface::util::run_in_thread_with_globals::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::closure_env$1<tupl
                               at X:\repos\rust\library\std\src\sys\backtrace.rs:152
 109:     0x7fff4fe6c1c1 - core::ops::function::FnOnce::call_once<std::thread::impl$0::spawn_unchecked_::closure_env$1<rustc_interface::util::run_in_thread_with_globals::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::i
                               at X:\repos\rust\library\core\src\ops\function.rs:250
 110:     0x7fff55c6369d - alloc::boxed::impl$28::call_once
                               at X:\repos\rust\library\alloc\src\boxed.rs:1970
 111:     0x7fff55c6369d - alloc::boxed::impl$28::call_once<tuple$<>,alloc::boxed::Box<dyn$<core::ops::function::FnOnce<tuple$<>,assoc$<Output,tuple$<> > > >,alloc::alloc::Global>,alloc::alloc::Global>
                               at X:\repos\rust\library\alloc\src\boxed.rs:1970
 112:     0x7fff55c54068 - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at X:\repos\rust\library\std\src\sys\pal\windows\thread.rs:56
 113:     0x7fffced2259d - BaseThreadInitThunk
 114:     0x7fffcefcaf38 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.85.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z treat-err-as-bug=1

query stack during panic:
#0 [entry_fn] looking up the entry function of a crate
#1 [analysis] running analysis passes on this crate
end of query stack
`x86_64-pc-windows-msvc` after
PS X:\repos\rust> rustc +stage1 .\foo.rs -Ztreat-err-as-bug=1
error: internal compiler error[E0601]: `main` function not found in crate `foo`
 --> .\foo.rs:1:13
  |
1 | fn meow() {}
  |             ^ consider adding a `main` function to `.\foo.rs`

thread 'rustc' panicked at compiler\rustc_errors\src\lib.rs:1781:17:
aborting due to `-Z treat-err-as-bug=1`
stack backtrace:
   0: std::panicking::begin_panic_handler
             at .\library\std\src\panicking.rs:681
   1: core::panicking::panic_fmt
             at .\library\core\src\panicking.rs:75
   2: rustc_errors::DiagCtxtInner::panic_if_treat_err_as_bug
             at .\compiler\rustc_errors\src\lib.rs:1781
   3: rustc_errors::impl$10::emit_diagnostic::closure$3
             at .\compiler\rustc_errors\src\lib.rs:1622
   4: rustc_interface::callbacks::track_diagnostic::closure$0::closure$0
             at .\compiler\rustc_interface\src\callbacks.rs:50
   5: rustc_middle::ty::context::tls::enter_context::closure$0
             at .\compiler\rustc_middle\src\ty\context\tls.rs:72
   6: std::thread::local::LocalKey::try_with
             at .\library\std\src\thread\local.rs:308
   7: std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_interface::callbacks::track_diagnostic::closure$0::closure_env$0<enum2$<core::option::Option<rustc_span::ErrorGua
             at .\library\std\src\thread\local.rs:272
   8: rustc_middle::ty::context::tls::with_context_opt
             at .\compiler\rustc_middle\src\ty\context\tls.rs:91
   9: rustc_interface::callbacks::track_diagnostic<enum2$<core::option::Option<rustc_span::ErrorGuaranteed> > >
             at .\compiler\rustc_interface\src\callbacks.rs:42
  10: rustc_errors::DiagCtxtInner::emit_diagnostic
             at .\compiler\rustc_errors\src\lib.rs:1551
  11: rustc_errors::DiagCtxtHandle::emit_diagnostic
             at .\compiler\rustc_errors\src\lib.rs:1080
  12: rustc_errors::diagnostic::Diag::emit_producing_error_guaranteed<rustc_span::ErrorGuaranteed>
             at .\compiler\rustc_errors\src\diagnostic.rs:1323
  13: rustc_errors::DiagCtxtHandle::emit_err<rustc_passes::errors::NoMainErr>
             at .\compiler\rustc_errors\src\lib.rs:1285
  14: rustc_passes::entry::no_main_err
             at .\compiler\rustc_passes\src\entry.rs:164
  15: rustc_passes::entry::configure_main
             at .\compiler\rustc_passes\src\entry.rs:129
  16: rustc_passes::entry::entry_fn
             at .\compiler\rustc_passes\src\entry.rs:50
      [... omitted 17 frames ...]
  17: rustc_middle::query::plumbing::query_ensure
             at .\compiler\rustc_middle\src\query\plumbing.rs:159
  18: rustc_middle::query::plumbing::TyCtxtEnsure::entry_fn
             at .\compiler\rustc_middle\src\query\plumbing.rs:194
  19: rustc_interface::passes::run_required_analyses::closure$0::closure$1::closure$0::closure$6::closure$0
             at .\compiler\rustc_interface\src\passes.rs:836
  20: rustc_data_structures::profiling::VerboseTimingGuard::run
             at .\compiler\rustc_data_structures\src\profiling.rs:753
  21: rustc_session::session::Session::time<tuple$<>,rustc_interface::passes::run_required_analyses::closure$0::closure$1::closure$0::closure$6::closure_env$0>
             at .\compiler\rustc_session\src\utils.rs:16
  22: core::panic::unwind_safe::impl$25::call_once
             at .\library\core\src\panic\unwind_safe.rs:272
  23: std::panicking::try::do_call
             at .\library\std\src\panicking.rs:573
  24: std::panicking::try
             at .\library\std\src\panicking.rs:536
  25: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::run_required_analyses::closure$0::closure$0::closure_env$0>,tuple$<> >
             at .\library\std\src\panic.rs:358
  26: rustc_data_structures::sync::parallel::ParallelGuard::run<tuple$<>,rustc_interface::passes::run_required_analyses::closure$0::closure$0::closure_env$0>
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:26
  27: rustc_interface::passes::run_required_analyses::closure$0::closure$0
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:90
  28: rustc_data_structures::sync::parallel::parallel_guard
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:42
  29: rustc_interface::passes::run_required_analyses::closure$0
             at .\compiler\rustc_interface\src\passes.rs:834
  30: rustc_data_structures::profiling::VerboseTimingGuard::run
             at .\compiler\rustc_data_structures\src\profiling.rs:753
  31: rustc_session::session::Session::time<tuple$<>,rustc_interface::passes::run_required_analyses::closure_env$0>
             at .\compiler\rustc_session\src\utils.rs:16
  32: rustc_interface::passes::run_required_analyses
             at .\compiler\rustc_interface\src\passes.rs:833
  33: rustc_interface::passes::analysis
             at .\compiler\rustc_interface\src\passes.rs:931
      [... omitted 17 frames ...]
  34: rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure$0
             at .\compiler\rustc_interface\src\passes.rs:813
  35: rustc_middle::ty::context::impl$23::create_global_ctxt::closure$3
             at .\compiler\rustc_middle\src\ty\context.rs:1555
  36: rustc_middle::ty::context::tls::enter_context::closure$0
             at .\compiler\rustc_middle\src\ty\context\tls.rs:72
  37: std::thread::local::LocalKey::try_with
             at .\library\std\src\thread\local.rs:308
  38: std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_middle::ty::context::impl$23::create_global_ctxt::closure_env$3<enum2$<core::option::Option<rustc_interface::quer
             at .\library\std\src\thread\local.rs:272
  39: rustc_middle::ty::context::tls::enter_context
             at .\compiler\rustc_middle\src\ty\context\tls.rs:69
  40: rustc_middle::ty::context::TyCtxt::create_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure_env$0<enum2$<core::option::Option<rustc_interface::queries::Link
             at .\compiler\rustc_middle\src\ty\context.rs:1555
  41: rustc_interface::passes::create_and_enter_global_ctxt::closure$2
             at .\compiler\rustc_interface\src\passes.rs:781
  42: core::ops::function::FnOnce::call_once<rustc_interface::passes::create_and_enter_global_ctxt::closure_env$2<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>,tuple$<ref$<rustc_session
             at .\library\core\src\ops\function.rs:250
  43: alloc::boxed::impl$28::call_once<tuple$<ref$<rustc_session::session::Session>,rustc_middle::ty::context::CurrentGcx,ref$<std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt> >,ref$<rustc_data_structures::sync::worker_local::WorkerLocal<rus
             at .\library\alloc\src\boxed.rs:1970
  44: rustc_interface::passes::create_and_enter_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>
             at .\compiler\rustc_interface\src\passes.rs:821
  45: rustc_interface::interface::run_compiler::closure$1::closure$0
             at .\compiler\rustc_interface\src\interface.rs:499
  46: core::panic::unwind_safe::impl$25::call_once
             at .\library\core\src\panic\unwind_safe.rs:272
  47: std::panicking::try::do_call
             at .\library\std\src\panicking.rs:573
  48: std::panicking::try
             at .\library\std\src\panicking.rs:536
  49: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::closure$1::closure_env$0<tuple$<>,rustc_driver_impl::run_compiler::closure_env$0> >,tuple$<> >
             at .\library\std\src\panic.rs:358
  50: rustc_interface::interface::run_compiler::closure$1
             at .\compiler\rustc_interface\src\interface.rs:499
  51: rustc_interface::util::run_in_thread_pool_with_globals::closure$0
             at .\compiler\rustc_interface\src\util.rs:143
  52: rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure$0
             at .\compiler\rustc_interface\src\util.rs:106
  53: scoped_tls::ScopedKey::set<rustc_span::SessionGlobals,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::clo
             at C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\scoped-tls-1.0.1\src\lib.rs:137
  54: rustc_span::create_session_globals_then<tuple$<>,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::closure_
             at .\compiler\rustc_span\src\lib.rs:138
  55: rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0
             at .\compiler\rustc_interface\src\util.rs:105
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.85.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z treat-err-as-bug=1

query stack during panic:
#0 [entry_fn] looking up the entry function of a crate
#1 [analysis] running analysis passes on this crate
end of query stack

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this indeed simplifies the dev build rustc ICEs quite a lot. If someone needs the full backtrace, they can still explicitly set RUST_BACKTRACE to override this logic.

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 25, 2024

📌 Commit c7a28d5 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 25, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 25, 2024
Rollup of 3 pull requests

Successful merges:

 - rust-lang#134743 (Default to short backtraces for dev builds of rustc itself)
 - rust-lang#134750 (Update `#[coverage(..)]` attribute error messages to match the current implementation)
 - rust-lang#134751 (Enable LSX feature for LoongArch OpenHarmony target)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit aef9d6b into rust-lang:master Dec 25, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 25, 2024
Rollup merge of rust-lang#134743 - jyn514:rustc-dev-short-backtraces, r=jieyouxu

Default to short backtraces for dev builds of rustc itself

A dev build almost certainly means that whoever's built the compiler has the opportunity to rerun it to collect a more complete trace. So we don't need to default to a complete trace; we should hide irrelevant details by default.
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 26, 2024
… r=jieyouxu

fix default-backtrace-ice test

when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error:
```
failures:

---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr"
diff of stderr:

7
8	aborting due to `-Z treat-err-as-bug=1`
9	stack backtrace:
-	(end_short_backtrace)
-	(begin_short_backtrace)
-	(end_short_backtrace)
-	(begin_short_backtrace)
+	      [... omitted 22 frames ...]
+
```
(note that you must *not* use --bless; we previously did not have an error annotation to verify it was a full backtrace instead of a short backtrace.)

this is a regression from setting RUST_BACKTRACE=1 by default in rust-lang#134743. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.

cc rust-lang#129658 (comment)

r? `@jieyouxu`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 26, 2024
…=jieyouxu

fix default-backtrace-ice test

when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error:
```
failures:

---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr"
diff of stderr:

7
8	aborting due to `-Z treat-err-as-bug=1`
9	stack backtrace:
-	(end_short_backtrace)
-	(begin_short_backtrace)
-	(end_short_backtrace)
-	(begin_short_backtrace)
+	      [... omitted 22 frames ...]
+
```
(note that you must *not* use --bless; we previously did not have an error annotation to verify it was a full backtrace instead of a short backtrace.)

this is a regression from setting RUST_BACKTRACE=1 by default in rust-lang#134743. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.

cc rust-lang#129658 (comment)

r? `@jieyouxu`
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 26, 2024
…=jieyouxu

fix default-backtrace-ice test

when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error:
```
failures:

---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr"
diff of stderr:

7
8	aborting due to `-Z treat-err-as-bug=1`
9	stack backtrace:
-	(end_short_backtrace)
-	(begin_short_backtrace)
-	(end_short_backtrace)
-	(begin_short_backtrace)
+	      [... omitted 22 frames ...]
+
```
(note that you must *not* use --bless; we previously did not have an error annotation to verify it was a full backtrace instead of a short backtrace.)

this is a regression from setting RUST_BACKTRACE=1 by default in rust-lang#134743. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.

cc rust-lang#129658 (comment)

r? `@jieyouxu`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 27, 2024
fix default-backtrace-ice test

when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error:
```
failures:

---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr"
diff of stderr:

7
8	aborting due to `-Z treat-err-as-bug=1`
9	stack backtrace:
-	(end_short_backtrace)
-	(begin_short_backtrace)
-	(end_short_backtrace)
-	(begin_short_backtrace)
+	      [... omitted 22 frames ...]
+
```
(note that you must *not* use --bless; we previously did not have an error annotation to verify it was a full backtrace instead of a short backtrace.)

this is a regression from setting RUST_BACKTRACE=1 by default in rust-lang/rust#134743. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.

cc rust-lang/rust#129658 (comment)

r? `@jieyouxu`
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
…=jieyouxu

fix default-backtrace-ice test

when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error:
```
failures:

---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr"
diff of stderr:

7
8	aborting due to `-Z treat-err-as-bug=1`
9	stack backtrace:
-	(end_short_backtrace)
-	(begin_short_backtrace)
-	(end_short_backtrace)
-	(begin_short_backtrace)
+	      [... omitted 22 frames ...]
+
```
(note that you must *not* use --bless; we previously did not have an error annotation to verify it was a full backtrace instead of a short backtrace.)

this is a regression from setting RUST_BACKTRACE=1 by default in rust-lang#134743. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.

cc rust-lang#129658 (comment)

r? `@jieyouxu`
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Jan 7, 2025
fix default-backtrace-ice test

when running `tests/ui/panics/default-backtrace-ice.rs locally it gave this error:
```
failures:

---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
Saved the actual stderr to "/home/jyn/src/rust3/build/x86_64-unknown-linux-gnu/test/ui/panics/default-backtrace-ice/default-backtrace-ice.stderr"
diff of stderr:

7
8	aborting due to `-Z treat-err-as-bug=1`
9	stack backtrace:
-	(end_short_backtrace)
-	(begin_short_backtrace)
-	(end_short_backtrace)
-	(begin_short_backtrace)
+	      [... omitted 22 frames ...]
+
```
(note that you must *not* use --bless; we previously did not have an error annotation to verify it was a full backtrace instead of a short backtrace.)

this is a regression from setting RUST_BACKTRACE=1 by default in rust-lang/rust#134743. we need to turn off the new behavior when running UI tests so that they reflect our dist compiler. normally that's done by checking `sess.unstable_opts.ui_testing`, but this happens extremely early in the compiler before we've expanded arg files. do an extremely simple hack that doesn't work in all cases - we don't need it to work in all cases, only when running UI tests.

cc rust-lang/rust#129658 (comment)

r? `@jieyouxu`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants